#include "stdafx.h"
#include "GuaQQImpl.h"

I_GuaQQ::~I_GuaQQ() {}

CGuaQQImpl::CGuaQQImpl()
{
	ZeroMemory(&m_init, sizeof(m_init));
}

CGuaQQImpl::~CGuaQQImpl()
{
	
}

void CGuaQQImpl::Release()
{
	delete this;
}

BOOL CGuaQQImpl::Init( PGUAQQ_INIT pInit )
{
	if (NULL==pInit)
		return FALSE;

	_InitLibQQ();
	m_init = *pInit;
	return TRUE;
}

HANDLE CGuaQQImpl::CreateUser( PGUAQQ_USER pUser )
{
	if (NULL==pUser)
		return NULL;

	qqclient* pQQ = m_myqq.libqq_create(pUser->nQQNum, pUser->szPwd);
	if (pQQ)
	{
		_INNER_ITEM* pItem = new _INNER_ITEM;
		pItem->pQQ = pQQ;
		pItem->userInfo = *pUser;
		return (HANDLE)pItem;
	}

	return NULL;
}

void CGuaQQImpl::FreeUser( HANDLE hUser )
{
	if (NULL==hUser)
		return;

	_INNER_ITEM* pItem = (_INNER_ITEM*)hUser;
	delete pItem;
}

BOOL CGuaQQImpl::LoginUser( HANDLE hUser )
{
	if (NULL==hUser)
		return FALSE;

	_INNER_ITEM* pItem = (_INNER_ITEM*)hUser;
//	m_myqq.libqq_login(pItem->pQQ);

	return FALSE;
}

BOOL CGuaQQImpl::QueryUser( HANDLE hUser, PGUAQQ_USER pUser )
{
	return FALSE;
}

BOOL CGuaQQImpl::_InitLibQQ()
{
	//m_myqq.Init();
	return FALSE;
	
}
